#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int herm(int n, int x)
{
    if (n == 0)
        return 1;
    if (1 == n)
        return 2;
    if (n > 1)
        return 2 * x * herm(n - 1, x) - 2 * (n - 1) * herm(n - 2, x);
}

int main() {
    int n = 0, x = 0;
    scanf("%d%d", &n, &x);
    printf("%d", herm(n, x));

    return 0;
}